home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / map.gl.p < prev    next >
Text File  |  2003-03-27  |  47KB  |  1,273 lines

  1. {
  2.   Hidden = TRUE;
  3.   ScriptID = script { 
  4.     @show{
  5.       /* set map to current truck position */
  6.       ResParseEvent(GuiChildByName(SELF, "truck_curr_position_icon"),"@activate");
  7.  
  8.       /* display current city description */
  9.       ResParseEvent(GuiChildByName(SELF, "city_picture_button"),"@activate");
  10.       
  11.       /* Teresa wants state summary button */
  12.       ResParseEvent(GuiChildByName(SELF, "state_summary_button"),"@activate");
  13.  
  14.     }
  15.     @updateCityStateViews {
  16.       ResParseEvent(ResByName("map.gl/city_information_button"),"@update");
  17.       ResParseEvent(ResByName("map.gl/city_picture_button"), "@update");
  18.       ResParseEvent(ResByName("map.gl/city_summary_button"), "@update");
  19.       ResParseEvent(ResByName("map.gl/state_information_button"),"@update");
  20.       ResParseEvent(ResByName("map.gl/state_bird_button"),"@update");
  21.       ResParseEvent(ResByName("map.gl/state_summary_button"),"@update");
  22.       ResParseEvent(ResByName("map.gl/state_flower_button"),"@update");
  23.     }
  24.   };
  25.   
  26.   ChildID = {
  27.     GuiAnimation("background") {
  28.       AnimationID = "image/map_screen.pcx";
  29.       X = 0;
  30.       Y = 0;
  31.     },
  32.     
  33.     /* DRAWS THE TILE MAP (BIG MAP) */
  34.     GuiTileMap("map") {
  35.       X = 22;
  36.       Y = 62;
  37.       TileMapID = "map.tm";
  38.       Width = 315;
  39.       Height = 268;
  40.       ScrollX = 0; /* set how much we are scrolled by, in this case nothing */
  41.       ScrollY = 0; 
  42.       ScriptID = Script {
  43.         @update {
  44.           resid Game;
  45.           resid Player;
  46.           resid actor_id;
  47.           resid map_id;
  48.           int   x;
  49.           int   y;
  50.           
  51.           /* == DRAW CURRENT TRUCK POSITION == */
  52.           /* get player information */          
  53.           Game      = ResByName("Game");
  54.           Player    = ResPropGetResID(Game,"game_cur_player"); 
  55.           map_id    = ResPropGetResID(SELF, "TileMapID");
  56.           actor_id  = ResByName("map.tm/truck");
  57.           
  58.           /* get truck x and y from player */
  59.           x = ResPropGetInt(Player,"nav_truck_x");
  60.           y = ResPropGetInt(Player,"nav_truck_y");
  61.                     
  62.           /* draw truck current coordinate on tile map */
  63.           ActorSetMXMY(actor_id, ((x-5) * 1000), ((y-5) * 1000)); 
  64.                     
  65.           /* == DRAW CURRENT TRUCK POSITION END == */
  66.         }
  67.         @loaded {
  68.           resid map_id;
  69.           resid actor_id;
  70.           resid line_id;
  71.           resid Game;
  72.           resid Player;
  73.           resid csv_data_id;
  74.           resid city_data_id;
  75.           resid route_data_id;
  76.           resid truck_id;
  77.           int   city_num;
  78.           int   segment_num;
  79.           int   row_count;
  80.           int   x;
  81.           int   y;
  82.           int   delta_y;
  83.           int   x1;
  84.           int   y1;
  85.           int   x2;
  86.           int   y2;
  87.           int   text_x;
  88.           int   text_y;
  89.           int   xOffset;
  90.           int   yOffset;
  91.           str   city_name;
  92.           str   cur_name;
  93.           resid map_actor_city_script_id;
  94.           resid city_font_id;
  95.  
  96.           xOffset           = -3; /* offset by 1/2 size of image - should calc it */
  97.           yOffset           = -3; /* ditto */        
  98.           map_id            = ResPropGetResID(SELF, "TileMapID");
  99.  
  100.           csv_data_id = ResByName("CSVData");
  101.           city_data_id = ResPropGetResID(csv_data_id, "city_id");
  102.           route_data_id = ResPropGetResID(csv_data_id, "route_id");
  103.  
  104.           row_count         = CSVGetRowCount(city_data_id);
  105.  
  106.           city_font_id = ResByName("font/verdana_9_black.tf");
  107.           map_actor_city_script_id = ResByName("map_actor_city.c4");
  108.  
  109.           /* read the cities */
  110.           city_num = 0;
  111.           while( city_num < row_count ) {
  112.             city_name = CSVGetStr(city_data_id, "name", city_num);
  113.             cur_name = StrFormatStr("map.tm/%s", city_name );
  114.             /*
  115.             actor_id = ResCreateWithPropFile("MapCityActor", cur_name, "map_actor_city.ac.p");
  116.             */
  117.             actor_id = ResCreate("MapCityActor", cur_name);
  118.             ResPropSetResID(actor_id, "ScriptID", map_actor_city_script_id);
  119.  
  120.             if (StrExact(CSVGetStr(city_data_id, "is_capital", city_num), "y")) {
  121.               ResPropSetResID(actor_id, "AnimationID", ResByName("gui/laptop/map_button/capital_city_dot.pcx"));
  122.               ResPropSetResID(actor_id, "dot", ResByName("gui/laptop/map_button/capital_city_dot.pcx"));
  123.               ResPropSetResID(actor_id, "selected_dot", ResByName("gui/laptop/map_button/capital_city_selected.pcx"));
  124.               ResPropSetInt  (actor_id, "ZOrder", 1);
  125.               /*
  126.               xOffset = -3;
  127.               yOffset = -3;
  128.               */
  129.             } else {
  130.               ResPropSetResID(actor_id, "AnimationID", ResByName("gui/laptop/map_button/blue_dot.pcx"));
  131.               ResPropSetResID(actor_id, "dot", ResByName("gui/laptop/map_button/blue_dot.pcx"));
  132.               ResPropSetResID(actor_id, "selected_dot", ResByName("gui/laptop/map_button/blue_selected.pcx"));
  133.               ResPropSetInt  (actor_id, "ZOrder", 1);
  134.               /*
  135.               xOffset = -3;
  136.               yOffset = -3;
  137.               */
  138.             }
  139.  
  140.             x = CSVGetInt(city_data_id, "X", city_num);
  141.             y = CSVGetInt(city_data_id, "Y", city_num);
  142.  
  143.             x += xOffset;
  144.             y += yOffset;
  145.  
  146.             text_x = CSVGetInt(city_data_id, "text_x", city_num);
  147.             
  148.             text_y = CSVGetInt(city_data_id, "text_y", city_num);
  149.     
  150.             text_y -= TextfontGetHeight(city_font_id, city_name);
  151.  
  152.  
  153.             if (StrExact(CSVGetStr(city_data_id, "text_align", city_num), "R")) {
  154.               /* the must match the font used by map_actor to draw the text!! */
  155.               text_x -= TextfontGetWidth(city_font_id, city_name);
  156.             }
  157.  
  158.             ResPropSetInt(actor_id, "text_x" , text_x);
  159.             ResPropSetInt(actor_id, "text_y" , text_y);
  160.            
  161.             ResPropSetStr(actor_id, "name" , city_name);
  162.             ActorSetMXMY(actor_id, x * 1000, y * 1000);
  163.             ActorAddToTileMap(actor_id, map_id);
  164.            
  165.             city_num += 1;
  166.           }
  167.           
  168.           /* populate the road segments */
  169.           segment_num = 0;
  170.           row_count = CSVGetRowCount(route_data_id);
  171.           while( segment_num < row_count ) {
  172.             cur_name = StrFormatStr("map.tm/line/segment%d.l", segment_num);
  173.             line_id = ResCreateWithPropFile("Line", cur_name, "map_line.l.p");
  174.  
  175.             cur_name = StrFormatStr("map.tm/segment%d", segment_num);
  176.             /*
  177.             actor_id = ResCreateWithPropFile("Actor", cur_name, "map_actor_line.ac.p");
  178.             */
  179.             actor_id = ResCreate("Actor", cur_name);
  180.             ResPropSetInt(actor_id, "DontAnimate", 1);
  181.  
  182.             x1 = CSVGetInt(route_data_id, "xb", segment_num);
  183.             y1 = CSVGetInt(route_data_id, "yb", segment_num);
  184.             
  185.             x2 = CSVGetInt(route_data_id, "xe", segment_num);
  186.             y2 = CSVGetInt(route_data_id, "ye", segment_num);
  187.  
  188.             x = Min(x1,x2);
  189.             y = Min(y1,y2);
  190.  
  191.             ResPropSetInt(line_id, "X1", x1-x);
  192.             ResPropSetInt(line_id, "X2", x2-x);
  193.  
  194.             ResPropSetInt(line_id, "Y1", y1-y);
  195.             ResPropSetInt(line_id, "Y2", y2-y);
  196.  
  197.             
  198.             ResPropSetResID(actor_id, "AnimationID", line_id);
  199.             ResPropSetInt  (actor_id, "ZOrder", 0);
  200.             ActorSetMXMY(actor_id, x * 1000, y * 1000);
  201.             ActorAddToTileMap(actor_id, map_id);
  202.            
  203.             segment_num += 1;
  204.           }
  205.           
  206.           /* == DRAW CURRENT TRUCK POSITION == */
  207.           /* get player information */          
  208.           Game      = ResByName("Game");
  209.           Player    = ResPropGetResID(Game,"game_cur_player"); 
  210.           
  211.           /* get truck x and y from player */
  212.           x = ResPropGetInt(Player,"nav_truck_x");
  213.           y = ResPropGetInt(Player,"nav_truck_y");
  214.                     
  215.           /* draw truck current coordinate on tile map */
  216.           actor_id = ResCreateWithPropFile("Actor", "map.tm/truck", "map_actor_truck.ac.p");
  217.           ResPropSetInt  (actor_id, "ZOrder", 2);
  218.           ActorSetMXMY(actor_id, ((x-5) * 1000), ((y-5) * 1000));
  219.           ActorAddToTileMap(actor_id, map_id);
  220.  
  221.         }
  222.       }
  223.     },
  224.     
  225.     GuiAnimation("minimap") {
  226.       AnimationID = "image/mini_map.pcx";
  227.       X = 22;
  228.       Y = 339;
  229.     },
  230.     
  231.     GuiMiniMapButton("minimapbutton") {
  232.       color = #ff0000;
  233.       IgnoreTransparency = TRUE;
  234.       ScriptID = Script {
  235.         @loaded {
  236.           resid id_map;
  237.           resid id_mini_map;
  238.           resid id_tile_map;
  239.           int mapX;
  240.           int mapY;
  241.           int mapWidth;
  242.           int mapHeight;
  243.           int mapViewWidth;
  244.           int mapViewHeight;
  245.           int miniMapWidth;
  246.           int miniMapHeight;
  247.           int Width;
  248.           int Height;
  249.           
  250.           ResPropAlias(SELF,"Width","Width");
  251.           ResPropAlias(SELF,"Height","Height");
  252.           
  253.           id_map        = GuiSiblingByName("map");
  254.           id_tile_map   = ResPropGetResID(id_map, "TileMapID");
  255.           id_mini_map   = GuiSiblingByName("minimap");
  256.           
  257.           mapX          = ResPropGetInt(id_map,      "X");
  258.           mapY          = ResPropGetInt(id_map,      "Y");
  259.           mapHeight     = ResPropGetInt(id_tile_map, "MapHeight");
  260.           mapWidth      = ResPropGetInt(id_tile_map, "MapWidth");
  261.           mapViewHeight = ResPropGetInt(id_map,      "Height");
  262.           mapViewWidth  = ResPropGetInt(id_map,      "Width");
  263.           miniMapHeight = ResPropGetInt(id_mini_map, "Height");
  264.           miniMapWidth  = ResPropGetInt(id_mini_map, "Width");
  265.           
  266.           ResPropSetInt(SELF, "mousedown", 0);
  267.           
  268.           ResPropSetInt(SELF, "X", ResPropGetInt(id_mini_map, "X"));
  269.           ResPropSetInt(SELF, "Y", ResPropGetInt(id_mini_map, "Y"));
  270.           
  271.           /* need to compute this based on the size of the map vs the size of the viewport and the size of the minimap */
  272.           Width  = (miniMapWidth  * mapViewWidth)  / mapWidth;
  273.           Height = (miniMapHeight * mapViewHeight) / mapHeight;
  274.           
  275.           ResPropSetInt(SELF, "scalemx", (1000 * mapWidth) /  miniMapWidth);
  276.           ResPropSetInt(SELF, "scalemy", (1000 * mapHeight) / miniMapHeight);
  277.           
  278.         }
  279.         @mousedown {
  280.           ResPropSetInt(SELF, "mousedown" , 1);
  281.           ResPropSetInt(SELF, "mousedragx", CVarGetInt("inputMouseX"));
  282.           ResPropSetInt(SELF, "mousedragy", CVarGetInt("inputMouseY"));
  283.         }
  284.         @mouseup {
  285.           ResPropSetInt(SELF, "mousedown" , 0);
  286.         }
  287.         @draw {
  288.           /* Draw the Rect X,Y,X+Width,Y+Height */
  289.           DrawRect(
  290.             ResPropGetInt(SELF,"ScreenX"),
  291.             ResPropGetInt(SELF,"ScreenY"),
  292.             ResPropGetInt(SELF,"Width"),
  293.             ResPropGetInt(SELF,"Height"),
  294.             TRANSPARENT, /*fill color*/
  295.             ResPropGetInt(SELF,"color"), /*border color*/
  296.             2  /*border Width*/
  297.           );
  298.         }
  299.         @mousemove {
  300.           resid id_map;
  301.           resid id_mini_map;
  302.           resid id_tile_map;
  303.           int mouseDragX;
  304.           int mouseDragY;
  305.           int mouseX;
  306.           int mouseY;
  307.           int y;
  308.           int x;
  309.           int minX;
  310.           int minY;
  311.           int maxX;
  312.           int maxY;
  313.           int ScrollX;
  314.           int ScrollY;
  315.           int mapHeight;
  316.           int mapWidth;
  317.           int mapViewHeight;
  318.           int mapViewWidth;
  319.           
  320.           if (ResPropGetInt(SELF,"mousedown")==1) {
  321.             id_map      = GuiSiblingByName("map");
  322.             id_mini_map = GuiSiblingByName("minimap");
  323.             id_tile_map = ResPropGetResID(id_map, "TileMapID");
  324.             
  325.             ResPropAlias(SELF, "mousedragx", "mouseDragX");
  326.             ResPropAlias(SELF, "mousedragy", "mouseDragY");
  327.             ResPropAlias(SELF, "X", "x");
  328.             ResPropAlias(SELF, "Y", "y");
  329.             
  330.             mouseX        = CVarGetInt("inputMouseX");
  331.             mouseY        = CVarGetInt("inputMouseY");
  332.             minX          = ResPropGetInt(id_mini_map, "X");
  333.             minY          = ResPropGetInt(id_mini_map, "Y");
  334.             maxX          = minX + ResPropGetInt(id_mini_map, "Width");
  335.             maxY          = minY + ResPropGetInt(id_mini_map, "Height");
  336.             mapHeight     = ResPropGetInt(id_tile_map, "MapHeight");
  337.             mapWidth      = ResPropGetInt(id_tile_map, "MapWidth");
  338.             mapViewHeight = ResPropGetInt(id_map,      "Height");
  339.             mapViewWidth  = ResPropGetInt(id_map,      "Width");
  340.  
  341.             mouseX = Bound(minX, mouseX, maxX);
  342.             mouseY = Bound(minY, mouseY, maxY);
  343.  
  344.             x = x + mouseX - mouseDragX;
  345.             y = y + mouseY - mouseDragY;
  346.             
  347.             maxX -= ResPropGetInt(SELF,"Width");
  348.             maxY -= ResPropGetInt(SELF,"Height");
  349.  
  350.             x = Bound(minX, x, maxX);
  351.             y = Bound(minY, y, maxY);
  352.             
  353.             mouseDragX = mouseX;
  354.             mouseDragY = mouseY;
  355.                      
  356.             ScrollX = ( (x - minX) * ResPropGetInt(SELF, "scalemx") ) / 1000;
  357.             ScrollY = ( (y - minY) * ResPropGetInt(SELF, "scalemy") ) / 1000;
  358.  
  359.             /*
  360.               The -1 in here shouldn't be needed, but without it you get
  361.               a line on the bottom that isn't drawn...
  362.             */
  363.             ScrollX = Bound(0, ScrollX, (mapWidth - mapViewWidth) - 1);
  364.             ScrollY = Bound(0, ScrollY, (mapHeight - mapViewHeight) - 1);
  365.  
  366.             ResPropSetInt(id_map, "ScrollX", -ScrollX);
  367.             ResPropSetInt(id_map, "ScrollY", -ScrollY);
  368.           }
  369.         }
  370.       }
  371.     },
  372.     
  373.     GuiTextInput("city_label") {
  374.       X = 341;
  375.       Y = 40;
  376.       Height = 23;
  377.       Width  = 213;
  378.       FontID = "font/verdana_black_bold_12.tf";
  379.       InputText = "";
  380.       InputDisabled = TRUE;
  381.       VerticalAlign = TOP;
  382.     },
  383.     
  384.     GuiTextInput("state_label") {
  385.       X = 340;
  386.       Y = 250;
  387.       Height = 23;
  388.       Width  = 195;
  389.       FontID = "font/verdana_black_bold_12.tf";
  390.       InputDisabled = TRUE;    
  391.       InputText = "";
  392.     },    
  393.  
  394.     GuiButton("city_information_button") {
  395.       X = 562;
  396.       Y = 40;
  397.       StyleID = "gui/bs/info.gbs";
  398.       AutoSize = HEIGHT;
  399.       ScriptID = Script {
  400.         @show { 
  401.           ResParseEvent(SELF, "@update");
  402.         }
  403.         @update { 
  404.           resid Game;
  405.           resid Player;
  406.           resid city_data_id;
  407.           str   city_description;
  408.           str   map_view_city;
  409.           int   map_view_city_row_num;
  410.           
  411.           /* get player information */
  412.           Game                      = ResByName("Game");
  413.           Player                    = ResPropGetResID(Game,"game_cur_player"); 
  414.           map_view_city_row_num     = ResPropGetInt(Player, "map_view_city_row_num");
  415.           map_view_city             = ResPropGetStr(Player, "map_view_city");
  416.           
  417.           /* get city description */
  418.           city_data_id              = ResPropGetResID(ResByName("CSVData"), "city_id");           
  419.           city_description          = CSVGetStr(city_data_id, "description", map_view_city_row_num);
  420.           
  421.           /* display city description */ 
  422.           ResPropSetStr(GuiSiblingByName("city_label"),"InputText", map_view_city);         
  423.           ResPropSetStr(GuiSiblingByName("city_information/city_description"),"InputText", city_description);
  424.         }
  425.         @activate {
  426.           ResParseEvent(SELF, "@update");
  427.           ResPropSetInt(GuiSiblingByName("city_information"),"Hidden",FALSE);
  428.           ResPropSetInt(GuiSiblingByName("city_image"),"Hidden",TRUE);
  429.           ResPropSetInt(GuiSiblingByName("city_summary"),"Hidden",TRUE);
  430.         }
  431.       };
  432.     },  
  433.       
  434.     GuiButton("city_picture_button") {
  435.       X = 581;
  436.       Y = 40;
  437.       StyleID = "gui/bs/photo.gbs";
  438.       AutoSize = HEIGHT;
  439.       ScriptID = Script {
  440.         @show { 
  441.           ResParseEvent(SELF, "@update");
  442.         }
  443.         @update { 
  444.           resid Game;
  445.           resid Player;
  446.           resid city_data_id;
  447.           str   city_picture;
  448.           str   caption_name;
  449.           int   map_view_city_row_num;
  450.           
  451.           /* get player information */
  452.           Game                      = ResByName("Game");
  453.           Player                    = ResPropGetResID(Game, "game_cur_player"); 
  454.           map_view_city_row_num     = ResPropGetInt(Player, "map_view_city_row_num"); 
  455.           caption_name              = "Caption";
  456.           
  457.           /* get city picture filename*/
  458.           city_data_id              = ResPropGetResID(ResByName("CSVData"), "city_id");      
  459.           city_picture              = CSVGetStr(city_data_id , "city_image", map_view_city_row_num);
  460.           city_picture              = StrFormatStr("csv_data/city/%s",city_picture);
  461.           
  462.           /* display city picture */
  463.           /* ResPropSetStr  (GuiSiblingByName("city_label"), "InputText", caption_name); */
  464.           ResPropSetResID(GuiSiblingByName("city_image/picture"), "AnimationID", ResByName(city_picture)); 
  465.         }
  466.         @activate {
  467.           ResParseEvent(SELF, "@update");
  468.           ResPropSetInt(GuiSiblingByName("city_information"),"Hidden",TRUE);
  469.           ResPropSetInt(GuiSiblingByName("city_image"),"Hidden",FALSE);
  470.           ResPropSetInt(GuiSiblingByName("city_summary"),"Hidden",TRUE);
  471.         }
  472.       };
  473.     },    
  474.  
  475.     GuiButton("city_summary_button") {
  476.       X = 600;
  477.       Y = 40;
  478.       StyleID = "gui/bs/summary.gbs";
  479.       AutoSize = HEIGHT;
  480.       ScriptID = Script {
  481.         @show {
  482.           ResParseEvent(SELF, "@update");
  483.         }
  484.         @update { 
  485.           resid city_temperature_id;
  486.           resid Game;
  487.           resid Player;
  488.           resid csv_data_id;
  489.           resid city_data_id;
  490.           resid state_data_id;
  491.           str   city_population;
  492.           str   city_location;
  493.           str   city_timezone;
  494.           str   city_summer;
  495.           str   city_winter;
  496.           str   city_commodity;
  497.           str   map_view_city;
  498.           int   city_lodging_tax;
  499.           int   state_food_tax;
  500.           int   map_view_city_row_num;
  501.           int   state_row;
  502.           str   com1;
  503.           str   com2;
  504.           str   com3;
  505.           str   state_ab;
  506.           
  507.           /* get player information */
  508.           Game                  = ResByName("Game");
  509.           Player                = ResPropGetResID(Game,"game_cur_player"); 
  510.           map_view_city         = ResPropGetStr(Player, "map_view_city");
  511.           map_view_city_row_num = ResPropGetInt(Player, "map_view_city_row_num");
  512.           
  513.           /* get city summary */
  514.           csv_data_id           = ResByName("CSVData");
  515.           city_data_id          = ResPropGetResID(csv_data_id, "city_id");
  516.           city_temperature_id   = ResPropGetResID(csv_data_id, "temperature_id");
  517.  
  518.           city_population       = CSVGetStr(city_data_id, "population", map_view_city_row_num);
  519.           city_location         = CSVGetStr(city_data_id, "location", map_view_city_row_num);
  520.           city_timezone         = CSVGetStr(city_data_id, "timezone", map_view_city_row_num);
  521.           city_lodging_tax      = CSVGetInt(city_data_id, "lodging_tax", map_view_city_row_num);
  522.           city_summer           = CSVGetStr(city_temperature_id, "summer_avg", CSVSearch(city_temperature_id, "city", map_view_city));
  523.           city_winter           = CSVGetStr(city_temperature_id, "winter_avg", CSVSearch(city_temperature_id, "city", map_view_city));
  524.           com1                  = CSVGetStr(city_data_id, "com1", map_view_city_row_num);
  525.           com2                  = CSVGetStr(city_data_id, "com2", map_view_city_row_num);
  526.           com3                  = CSVGetStr(city_data_id, "com3", map_view_city_row_num);
  527.           
  528.           /* get state food tax */
  529.           state_ab              = CSVGetStr(city_data_id, "state", map_view_city_row_num);
  530.           state_data_id         = ResPropGetResID(csv_data_id, "state_id");
  531.           state_row             = CSVSearch(state_data_id, "abbreviation", state_ab);
  532.           state_food_tax        = CSVGetInt(state_data_id, "food_tax", state_row);
  533.  
  534.           if (StrExact(com1, "")) {
  535.             city_commodity = "None";
  536.           } else {
  537.             city_commodity = com1;
  538.             if (!StrExact(com2, "")) {
  539.               city_commodity = StrFormatStr("%s, %s", city_commodity, com2);
  540.               if (!StrExact(com3, "")) {
  541.                 city_commodity = StrFormatStr("%s, %s", city_commodity, com3);
  542.               }
  543.             }
  544.           }
  545.           
  546.           /* display city summary */
  547.           /* ResPropSetStr(GuiSiblingByName("city_label"),"InputText",StrFormatStr("%s's Statistic",map_view_city)); */
  548.           ResPropSetStr(GuiSiblingByName("city_summary/city_population"),"InputText",city_population);
  549.           ResPropSetStr(GuiSiblingByName("city_summary/city_location"),"InputText",city_location);
  550.           ResPropSetStr(GuiSiblingByName("city_summary/city_timezone"),"InputText",city_timezone);          
  551.           ResPropSetStr(GuiSiblingByName("city_summary/city_lodging"),"InputText",StrFormatStr("%s%s", IntToDecimalStr(city_lodging_tax,100)," %"));
  552.           ResPropSetStr(GuiSiblingByName("city_summary/city_food"),"InputText",StrFormatStr("%s%s", IntToDecimalStr(state_food_tax,100)," %"));
  553.           ResPropSetStr(GuiSiblingByName("city_summary/city_summer"),"InputText", StrFormatStr("%s %s", city_summer, ResPropGetStr(Game,"game_temperature_unit_short")));
  554.           ResPropSetStr(GuiSiblingByName("city_summary/city_winter"),"InputText",StrFormatStr("%s %s", city_winter, ResPropGetStr(Game,"game_temperature_unit_short")));
  555.           ResPropSetStr(GuiSiblingByName("city_summary/city_commodity"),"InputText",city_commodity);          
  556.          }
  557.         @activate {
  558.           ResParseEvent(SELF, "@update");
  559.           ResPropSetInt(GuiSiblingByName("city_information"),"Hidden",TRUE);
  560.           ResPropSetInt(GuiSiblingByName("city_image"),"Hidden",TRUE);
  561.           ResPropSetInt(GuiSiblingByName("city_summary"),"Hidden",FALSE);
  562.         }
  563.       };
  564.     },        
  565.       
  566.     GuiButton("state_information_button") {
  567.       X = 543;
  568.       Y = 250;
  569.       StyleID = "gui/bs/info.gbs";
  570.       AutoSize = HEIGHT;
  571.       ScriptID = Script {
  572.         @show {
  573.           ResParseEvent(SELF,"@update");
  574.         }
  575.         @update {
  576.           resid Game;
  577.           resid Player;
  578.           resid state_data_id;
  579.           str   state_description;
  580.           str   map_view_state;
  581.           int   map_view_state_row_num;
  582.                     
  583.           /* get player information */
  584.           Game                    = ResByName("Game");
  585.           Player                  = ResPropGetResID(Game,"game_cur_player"); 
  586.           map_view_state           = ResPropGetStr(Player, "map_view_state");
  587.           map_view_state_row_num   = ResPropGetInt(Player, "map_view_state_row_num");
  588.           
  589.           /* get state description */
  590.           state_data_id           = ResPropGetResID(ResByName("CSVData"), "state_id");                          
  591.           state_description       = CSVGetStr(state_data_id , "description", map_view_state_row_num);
  592.           
  593.           /* display state description */
  594.           ResPropSetStr(GuiSiblingByName("state_label"),"InputText", map_view_state);
  595.           ResPropSetStr(GuiSiblingByName("state_information/state_description"),"InputText", state_description);
  596.         }
  597.         @activate { 
  598.           ResParseEvent(SELF, "@update");
  599.           ResPropSetInt(GuiSiblingByName("state_information"),"Hidden",FALSE);
  600.           ResPropSetInt(GuiSiblingByName("state_image"),"Hidden",TRUE);
  601.           ResPropSetInt(GuiSiblingByName("state_summary"),"Hidden",TRUE);      
  602.         }
  603.       };
  604.     },       
  605.  
  606.     GuiButton("state_flower_button") {
  607.       X = 562;
  608.       Y = 250;
  609.       StyleID = "gui/bs/flower.gbs";
  610.       AutoSize = HEIGHT;
  611.       ScriptID = Script {
  612.         @show {
  613.           ResParseEvent(SELF, "@update");
  614.         }
  615.         @update { 
  616.           resid Game;
  617.           resid Player;
  618.           resid state_data_id;
  619.           str   state_flower_image;
  620.           str   state_flower_name;
  621.           int   map_view_state_row_num;
  622.           
  623.           /* get player information */
  624.           Game                    = ResByName("Game");
  625.           Player                  = ResPropGetResID(Game,"game_cur_player"); 
  626.           map_view_state_row_num  = ResPropGetInt(Player, "map_view_state_row_num");
  627.           
  628.           /* get state flower image file */
  629.           state_data_id           = ResPropGetResID(ResByName("CSVData"), "state_id");          
  630.           state_flower_name       = CSVGetStr(state_data_id , "flower", map_view_state_row_num);
  631.           state_flower_image      = StrFormatStr("csv_data/flower/%s", CSVGetStr(state_data_id , "flower_image", map_view_state_row_num));
  632.           
  633.           /* display state flower image */
  634.           /* ResPropSetStr  (GuiSiblingByName("state_label"), "InputText", state_flower_name); */
  635.            ResPropSetResID(GuiSiblingByName("state_image/picture"), "AnimationID", ResByName(state_flower_image));
  636.         }
  637.         @activate {
  638.           ResParseEvent(SELF, "@update");
  639.           ResPropSetInt(GuiSiblingByName("state_information"),"Hidden",TRUE);
  640.           ResPropSetInt(GuiSiblingByName("state_image"),"Hidden",FALSE);
  641.           ResPropSetInt(GuiSiblingByName("state_summary"),"Hidden",TRUE);      
  642.         }
  643.       };
  644.     },   
  645.  
  646.     GuiButton("state_bird_button") {
  647.       X = 581;
  648.       Y = 250;
  649.       StyleID = "gui/bs/bird.gbs";
  650.       AutoSize = HEIGHT;
  651.       ScriptID = Script {
  652.         @show { 
  653.           ResParseEvent(SELF,"@update");
  654.         }
  655.         @update { 
  656.           resid Game;
  657.           resid Player;
  658.           resid state_data_id;
  659.           str   state_bird_image;
  660.           str   state_bird_name;
  661.           int   map_view_state_row_num;
  662.  
  663.           /* get player information */
  664.           Game                    = ResByName("Game");
  665.           Player                  = ResPropGetResID(Game, "game_cur_player"); 
  666.           map_view_state_row_num  = ResPropGetInt(Player, "map_view_state_row_num");
  667.           
  668.           /* get state bird image file */
  669.           state_data_id           = ResPropGetResID(ResByName("CSVData"), "state_id");                           
  670.           state_bird_name         = CSVGetStr(state_data_id , "bird", map_view_state_row_num);
  671.           state_bird_image        = StrFormatStr("csv_data/bird/%s", CSVGetStr(state_data_id , "bird_image", map_view_state_row_num));
  672.           
  673.           /* display state bird image */
  674.           /* ResPropSetStr  (GuiSiblingByName("state_label"), "InputText", state_bird_name); */
  675.           ResPropSetResID(GuiSiblingByName("state_image/picture"), "AnimationID", ResByName(state_bird_image));
  676.         }
  677.         @activate {
  678.           ResParseEvent(SELF, "@update");
  679.           ResPropSetInt(GuiSiblingByName("state_information"),"Hidden",TRUE);
  680.           ResPropSetInt(GuiSiblingByName("state_image"),"Hidden",FALSE);
  681.            ResPropSetInt(GuiSiblingByName("state_summary"),"Hidden",TRUE);      
  682.         }
  683.       };
  684.     },   
  685.     
  686.     GuiButton("state_summary_button") {
  687.       X = 600;
  688.       Y = 250;
  689.       StyleID = "gui/bs/summary.gbs";
  690.       AutoSize = HEIGHT;
  691.       ScriptID = Script {
  692.         @show { 
  693.           ResParseEvent(SELF, "@update");
  694.         }
  695.         @update { 
  696.           resid Game;
  697.           resid Player;
  698.           resid state_data_id;
  699.           str   state_population;
  700.           str   state_capital;
  701.           str   state_size;
  702.           str   state_climate;
  703.           str   state_flower;
  704.           str   state_bird;
  705.           str   state_nickname;
  706.           int   state_fuel_tax;
  707.           str   map_view_state;
  708.           int   map_view_state_row_num;
  709.           
  710.           /* get player information */
  711.           Game                    = ResByName("Game");
  712.           Player                  = ResPropGetResID(Game,"game_cur_player"); 
  713.           map_view_state          = ResPropGetStr(Player, "map_view_state");
  714.           map_view_state_row_num  = ResPropGetInt(Player, "map_view_state_row_num");
  715.           
  716.           /* get state summary */
  717.           state_data_id           = ResPropGetResID(ResByName("CSVData"), "state_id");                           
  718.           state_population        = CSVGetStr(state_data_id, "population", map_view_state_row_num);
  719.           state_capital           = CSVGetStr(state_data_id, "capital", map_view_state_row_num);
  720.           state_size              = CSVGetStr(state_data_id, "size", map_view_state_row_num);      
  721.           state_climate           = CSVGetStr(state_data_id, "climate", map_view_state_row_num); 
  722.           state_nickname          = CSVGetStr(state_data_id, "nickname", map_view_state_row_num);
  723.           state_bird              = CSVGetStr(state_data_id, "bird", map_view_state_row_num); 
  724.           state_flower            = CSVGetStr(state_data_id, "flower", map_view_state_row_num); 
  725.           state_fuel_tax          = CSVGetInt(state_data_id, "fuel_tax", map_view_state_row_num); 
  726.           
  727.           /* display state summary */
  728.           /* ResPropSetStr(GuiSiblingByName("state_label"),"InputText", StrFormatStr("%s's Statistic",map_view_state)); */
  729.           ResPropSetStr(GuiSiblingByName("state_summary/state_population"),"InputText",state_population);
  730.           ResPropSetStr(GuiSiblingByName("state_summary/state_capital"),"InputText",state_capital);
  731.           ResPropSetStr(GuiSiblingByName("state_summary/state_size"),"InputText",StrFormatStr("%s %s",state_size,ResPropGetStr(Game,"game_distance_unit_square")));
  732.           ResPropSetStr(GuiSiblingByName("state_summary/state_climate"),"InputText",state_climate);
  733.           ResPropSetStr(GuiSiblingByName("state_summary/state_nickname"),"InputText",state_nickname);
  734.           ResPropSetStr(GuiSiblingByName("state_summary/state_bird"),"InputText",state_bird);
  735.           ResPropSetStr(GuiSiblingByName("state_summary/state_flower"),"InputText",state_flower);          
  736.           ResPropSetStr(GuiSiblingByName("state_summary/state_fuel_tax"),"InputText", StrFormatStr("%d%s",state_fuel_tax, " %"));
  737.         }
  738.         @activate {
  739.           ResParseEvent(SELF, "@update");
  740.           ResPropSetInt(GuiSiblingByName("state_information"),"Hidden",TRUE);
  741.           ResPropSetInt(GuiSiblingByName("state_image"),"Hidden",TRUE);
  742.           ResPropSetInt(GuiSiblingByName("state_summary"),"Hidden",FALSE);
  743.         }
  744.       };
  745.     },
  746.     
  747.     GuiLayer("city_information") {
  748.       X = 346;
  749.       Y = 41;
  750.       
  751.       ChildID = {
  752.         GuiTextInput("city_description") {
  753.           X = 0;
  754.           Y = 24;
  755.           Width = 275;
  756.           Height = 184;
  757.               InputDisabled = TRUE;  
  758.           InputVerticalAlign = TOP;
  759.           FontID = "font/arial_black_14.tf";
  760.           MaxLength = 4096;
  761.           InputText = 4096:"";
  762.           WordWrap = 1;
  763.           ChildID = {
  764.             GuiScrollBar ("sb") {
  765.               Kind = VERTICAL;
  766.               ChildID = {
  767.                 GuiButton("thumb") {
  768.                   StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
  769.                 },
  770.                 GuiButton("dec") {
  771.                   StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
  772.                 },
  773.                 GuiButton("inc") {
  774.                   StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
  775.                 }
  776.               };
  777.             }
  778.           };
  779.         }   /* END OF city_description */
  780.       };    /* END OF city_information CHILDID */
  781.     },
  782.  
  783.     GuiLayer("city_image") {
  784.       X = 347;
  785.       Y = 40;
  786.       Hidden = TRUE;
  787.       ChildID = {
  788.         GuiAnimation("picture") {
  789.           X = 0;
  790.           Y = 24;
  791.         }
  792.       };
  793.     },
  794.  
  795.     GuiLayer("city_summary") {
  796.       X = 346;
  797.       Y = 75;
  798.       Hidden = TRUE;
  799.       ChildID = {
  800.       
  801.         GuiTextInput("city_population_title") {
  802.           X = 10;
  803.           Y = 0;
  804.           Height = 21;
  805.           Width = 85;
  806.               InputDisabled = TRUE;  
  807.           FontID = "font/arial_black_14.tf";
  808.           InputText = Mangle(323/*"Population:"*/);
  809.         },
  810.         GuiTextInput("city_population") {
  811.           X = 100;
  812.           Y = 0;
  813.           Height = 21;
  814.           Width = 166;
  815.               InputDisabled = TRUE; 
  816.           FontID = "font/arial_black_14.tf";
  817.           InputText = "";
  818.         },        
  819.         GuiTextInput("city_location_title") {
  820.           X = 10;
  821.           Y = 20;
  822.           Height = 21;
  823.           Width = 85;   
  824.               InputDisabled = TRUE;    
  825.           FontID = "font/arial_black_14.tf";
  826.           InputText = Mangle(324/*"Location:"*/);
  827.         },     
  828.         GuiTextInput("city_location") {
  829.           X = 100;
  830.           Y = 20;
  831.           Height = 21;
  832.           Width = 166;  
  833.               InputDisabled = TRUE;       
  834.           FontID = "font/arial_black_14.tf";
  835.           InputText = "";
  836.         },             
  837.         GuiTextInput("city_timezone_title") {
  838.           X = 10;
  839.           Y = 40;
  840.           Height = 21;
  841.           Width = 85;
  842.               InputDisabled = TRUE; 
  843.           FontID = "font/arial_black_14.tf";
  844.           InputText = Mangle(325/*"Timezone:"*/);
  845.         },  
  846.         GuiTextInput("city_timezone") {
  847.           X = 100;
  848.           Y = 40;
  849.           Height = 21;
  850.           Width = 166;
  851.               InputDisabled = TRUE; 
  852.           FontID = "font/arial_black_14.tf";
  853.           InputText = "";
  854.         },
  855.         GuiTextInput("city_commodity_title") {
  856.           X = 10;
  857.           Y = 60;
  858.           Height = 21;
  859.           Width = 85;  
  860.               InputDisabled = TRUE; 
  861.           FontID = "font/arial_black_14.tf";
  862.           InputText = Mangle(326/*"Commodity:"*/);
  863.         },          
  864.         GuiTextInput("city_commodity") {
  865.           X = 100;
  866.           Y = 60;
  867.           Height = 21;
  868.           Width = 166; 
  869.               InputDisabled = TRUE;   
  870.           FontID = "font/arial_black_14.tf";
  871.           InputText = "";
  872.         },         
  873.         GuiTextInput("city_lodging_title") {
  874.           X = 10;
  875.           Y = 80;
  876.           Height = 21;
  877.           Width = 149;  
  878.               InputDisabled = TRUE;       
  879.           FontID = "font/arial_black_14.tf";
  880.           InputText = Mangle(327/*"Lodging Tax:"*/);
  881.         }, 
  882.         GuiTextInput("city_lodging") {
  883.           X = 100;
  884.           Y = 80;
  885.           Height = 21;
  886.           Width = 115;  
  887.               InputDisabled = TRUE;         
  888.           FontID = "font/arial_black_14.tf";
  889.           InputText = "";
  890.         },    
  891.         GuiTextInput("city_food_title") {
  892.           X = 10;
  893.           Y = 100;
  894.           Height = 21;
  895.           Width = 149;  
  896.               InputDisabled = TRUE;       
  897.           FontID = "font/arial_black_14.tf";
  898.           InputText = Mangle(328/*"Food Tax:"*/);
  899.         }, 
  900.         GuiTextInput("city_food") {
  901.           X = 100;
  902.           Y = 100;
  903.           Height = 21;
  904.           Width = 115;  
  905.               InputDisabled = TRUE;         
  906.           FontID = "font/arial_black_14.tf";
  907.           InputText = "";
  908.         },    
  909.         GuiTextInput("city_summer_title") {
  910.           X = 10;
  911.           Y = 120;
  912.           Height = 21;
  913.           Width = 149;  
  914.               InputDisabled = TRUE;       
  915.           FontID = "font/arial_black_14.tf";
  916.           InputText = Mangle(329/*"Average Summer Temp:"*/);
  917.         },  
  918.         GuiTextInput("city_summer") {
  919.           X = 160;
  920.           Y = 120;
  921.           Height = 21;
  922.           Width = 115;  
  923.               InputDisabled = TRUE;         
  924.           FontID = "font/arial_black_14.tf";
  925.           InputText = "";
  926.         },          
  927.         GuiTextInput("city_winter_title") {
  928.           X = 10;
  929.           Y = 140;
  930.           Height = 21;
  931.           Width = 145;  
  932.               InputDisabled = TRUE;         
  933.           FontID = "font/arial_black_14.tf";
  934.           InputText = Mangle(330/*"Average Winter Temp:"*/);
  935.         },
  936.         GuiTextInput("city_winter") {
  937.           X = 160;
  938.           Y = 140;
  939.           Height = 21;
  940.           Width = 120;  
  941.               InputDisabled = TRUE;           
  942.           FontID = "font/arial_black_14.tf";
  943.           InputText = "";
  944.         }
  945.       };
  946.     },
  947.  
  948.     GuiLayer("state_information") {
  949.       X = 346;
  950.       Y = 251;
  951.       ChildID = {
  952.         GuiTextInput("state_description") {
  953.           X = 0;
  954.           Y = 25;
  955.           Width = 275;
  956.           Height = 184;
  957.               InputDisabled = TRUE; 
  958.           InputVerticalAlign = TOP;
  959.           FontID = "font/arial_black_14.tf";
  960.           MaxLength = 4096;
  961.           InputText = 4096:"";
  962.           WordWrap = 1;
  963.           ChildID = {
  964.             GuiScrollBar ("sb") {
  965.               Kind = VERTICAL;
  966.               ChildID = {
  967.                 GuiButton("thumb") {
  968.                   StyleID = "gui/laptop/scrollbar/sb_thumb.gbs";
  969.                 },
  970.                 GuiButton("dec") {
  971.                   StyleID = "gui/laptop/scrollbar/sb_uarrow.gbs";
  972.                 },
  973.                 GuiButton("inc") {
  974.                   StyleID = "gui/laptop/scrollbar/sb_darrow.gbs";
  975.                 }
  976.               };
  977.             }
  978.           };
  979.         }
  980.       };
  981.     },
  982.  
  983.     GuiLayer("state_image") {
  984.       X = 346;
  985.       Y = 251;
  986.       Hidden = TRUE;
  987.       ChildID = {
  988.         GuiAnimation("picture") {
  989.           X = 0;
  990.           Y = 25;
  991.         }
  992.       };
  993.     },
  994.  
  995.     GuiLayer("state_summary") {
  996.       X = 346;
  997.       Y = 285;
  998.       Hidden = TRUE;
  999.       ChildID = {
  1000.       
  1001.         GuiTextInput("state_population_title") {
  1002.           X = 10;
  1003.           Y = 0;
  1004.           Width = 87;
  1005.           Height = 21;
  1006.               InputDisabled = TRUE; 
  1007.           FontID = "font/arial_black_14.tf";
  1008.           InputText = Mangle(331/*"Population:"*/);
  1009.         },
  1010.         GuiTextInput("state_population") {
  1011.           X = 100;
  1012.           Y = 0;
  1013.           Width = 168;
  1014.           Height = 21;
  1015.               InputDisabled = TRUE; 
  1016.           FontID = "font/arial_black_14.tf";
  1017.           InputText = "";
  1018.         },          
  1019.         GuiTextInput("state_capital_title") {
  1020.           X = 10;
  1021.           Y = 20;
  1022.           Width = 87;
  1023.           Height = 21;
  1024.               InputDisabled = TRUE; 
  1025.           FontID = "font/arial_black_14.tf";
  1026.           InputText = Mangle(332/*"Capital:"*/);
  1027.         }, 
  1028.         GuiTextInput("state_capital") {
  1029.           X = 100;
  1030.           Y = 20;
  1031.           Width = 168;
  1032.           Height = 21;
  1033.               InputDisabled = TRUE; 
  1034.           FontID = "font/arial_black_14.tf";
  1035.           InputText = "";
  1036.         },         
  1037.         GuiTextInput("state_nickname_title") {
  1038.           X = 10;
  1039.           Y = 40;
  1040.           Width = 87;
  1041.           Height = 21;
  1042.               InputDisabled = TRUE; 
  1043.           FontID = "font/arial_black_14.tf";
  1044.           InputText = Mangle(333/*"Nickname:"*/);
  1045.         },
  1046.         GuiTextInput("state_nickname") {
  1047.           X = 100;
  1048.           Y = 40;
  1049.           Width = 168;
  1050.           Height = 21;
  1051.               InputDisabled = TRUE; 
  1052.           FontID = "font/arial_black_14.tf";
  1053.           InputText = "";
  1054.         },        
  1055.         GuiTextInput("state_size_title") {
  1056.           X = 10;
  1057.           Y = 60;
  1058.           Width = 87;
  1059.           Height = 21;
  1060.               InputDisabled = TRUE; 
  1061.           FontID = "font/arial_black_14.tf";
  1062.           InputText = Mangle(334/*"Area:"*/);
  1063.         }, 
  1064.         GuiTextInput("state_size") {
  1065.           X = 100;
  1066.           Y = 60;
  1067.           Width = 168;
  1068.           Height = 21;
  1069.               InputDisabled = TRUE; 
  1070.           FontID = "font/arial_black_14.tf";
  1071.           InputText = "";
  1072.         },             
  1073.         GuiTextInput("state_climate_title") {
  1074.           X = 10;
  1075.           Y = 80;
  1076.           Width = 87;
  1077.           Height = 21;
  1078.               InputDisabled = TRUE; 
  1079.           FontID = "font/arial_black_14.tf";
  1080.           InputText = Mangle(335/*"Climate Code:"*/);
  1081.         }, 
  1082.         GuiTextInput("state_climate") {
  1083.           X = 100;
  1084.           Y = 80;
  1085.           Width = 168;
  1086.           Height = 21;
  1087.               InputDisabled = TRUE; 
  1088.           FontID = "font/arial_black_14.tf";
  1089.           InputText = "";
  1090.         },  
  1091.         GuiTextInput("state_flower_title") {
  1092.           X = 10;
  1093.           Y = 100;
  1094.           Width = 87;
  1095.           Height = 21;
  1096.               InputDisabled = TRUE; 
  1097.           FontID = "font/arial_black_14.tf";
  1098.           InputText = Mangle(336/*"Flower:"*/);
  1099.         },      
  1100.         GuiTextInput("state_flower") {
  1101.           X = 100;
  1102.           Y = 100;
  1103.           Width = 168;
  1104.           Height = 21;
  1105.               InputDisabled = TRUE; 
  1106.           FontID = "font/arial_black_14.tf";
  1107.           InputText = "";
  1108.         },
  1109.         GuiTextInput("state_bird_title") {
  1110.           X = 10;
  1111.           Y = 120;
  1112.           Width = 87;
  1113.           Height = 21;
  1114.               InputDisabled = TRUE; 
  1115.           FontID = "font/arial_black_14.tf";
  1116.           InputText = Mangle(337/*"Bird:"*/);
  1117.         },      
  1118.         GuiTextInput("state_bird") {
  1119.           X = 100;
  1120.           Y = 120;
  1121.           Width = 168;
  1122.           Height = 21;
  1123.               InputDisabled = TRUE; 
  1124.           FontID = "font/arial_black_14.tf";
  1125.           InputText = "";
  1126.         },
  1127.             
  1128.         GuiTextInput("state_fuel_tax_title") {
  1129.           X = 10;
  1130.           Y = 140;
  1131.           Width = 87;
  1132.           Height = 21;
  1133.               InputDisabled = TRUE; 
  1134.           FontID = "font/arial_black_14.tf";
  1135.           InputText = Mangle(338/*"Fuel Tax:"*/);
  1136.         },  
  1137.         GuiTextInput("state_fuel_tax") {
  1138.           X = 100;
  1139.           Y = 140;
  1140.           Width = 168;
  1141.           Height = 21;
  1142.               InputDisabled = TRUE; 
  1143.           FontID = "font/arial_black_14.tf";
  1144.           InputText = "";
  1145.         }
  1146.       };
  1147.     },
  1148.  
  1149.     
  1150.     GuiTextInput("screen_name") {
  1151.       X = 30;
  1152.       Y = 40;
  1153.       Width = 100;
  1154.       Height = 20;
  1155.       FontID = "font/verdana_9.tf";
  1156.       InputDisabled = TRUE;    
  1157.       InputText = Mangle(339/*"Detailed Map"*/);
  1158.     },
  1159.     
  1160.     /* BUTTON TO DISPLAY CURRENT TRUCK POSITION ON TILE MAP */
  1161.     GuiButton("truck_curr_position_icon") {
  1162.       X = 320;
  1163.       Y = 40;
  1164.       StyleID = "gui/bs/truck.gbs";
  1165.       AutoSize = HEIGHT;
  1166.       ScriptID = Script {
  1167.         @activate { 
  1168.           resid Player;
  1169.           resid Game;
  1170.           resid city_data_id;
  1171.           resid id_map;
  1172.           resid id_tile_map;
  1173.           resid id_mini_map_button;
  1174.           resid id_mini_map;
  1175.           
  1176.           int   x;
  1177.           int   y;
  1178.  
  1179.           int   nav_cur_city_row_num;
  1180.           int   nav_cur_state_row_num;
  1181.           str   nav_cur_city;
  1182.           str   nav_cur_state;
  1183.  
  1184.           int   view_max_x;
  1185.           int   view_max_y;
  1186.           int   tile_max_x;
  1187.           int   tile_max_y;
  1188.           int   scaleX;
  1189.           int   scaleY;
  1190.           int   minimap_x;
  1191.           int   minimap_y;
  1192.           int   minX;
  1193.           int   minY;
  1194.           int   maxX;
  1195.           int   maxY;
  1196.            
  1197.         
  1198.           /* get player information */
  1199.           Game                  = ResByName("Game");
  1200.           Player                = ResPropGetResID(Game,"game_cur_player"); 
  1201.           nav_cur_city          = ResPropGetStr(Player, "nav_cur_city");  
  1202.           nav_cur_state         = ResPropGetStr(Player, "nav_cur_state");  
  1203.           nav_cur_city_row_num  = ResPropGetInt(Player, "nav_cur_city_row_num");  
  1204.           nav_cur_state_row_num = ResPropGetInt(Player, "nav_cur_state_row_num");  
  1205.                    
  1206.           /* get IDs */
  1207.           id_map        = GuiSiblingByName("map");  
  1208.           id_tile_map   = ResPropGetResID(id_map, "TileMapID");
  1209.           city_data_id  = ResPropGetResID(ResByName("CSVData"), "city_id"); 
  1210.           
  1211.           /* get city coordinates */
  1212.           x = ResPropGetInt(Player, "nav_truck_x");
  1213.           y = ResPropGetInt(Player, "nav_truck_y");
  1214.       
  1215.           /* get window size */
  1216.           view_max_x = ResPropGetInt(id_map, "Width");
  1217.           view_max_y = ResPropGetInt(id_map, "Height");
  1218.           
  1219.           /* get map size */
  1220.           tile_max_x = ResPropGetInt(id_tile_map, "TileWidth");
  1221.           tile_max_y = ResPropGetInt(id_tile_map, "TileHeight");          
  1222.  
  1223.           /* guard viewing city out of boundary */
  1224.           if ((x+(view_max_x/2)) > tile_max_x) {
  1225.             x = 1683;
  1226.           } else if ((x-(view_max_x/2)) < 0) {
  1227.             x = 0;
  1228.           } else {
  1229.             x -= (view_max_x/2);          
  1230.           }
  1231.        
  1232.             
  1233.           if ((y+(view_max_y/2)) > tile_max_y) {
  1234.             y = 553;
  1235.           } else if ((y-(view_max_y/2)) < 0) {
  1236.             y = 0;            
  1237.           }else {
  1238.             y -= (view_max_y/2);
  1239.           }
  1240.           
  1241.           /* set view (window) coordinate on big map*/
  1242.           ResPropSetInt(id_map, "ScrollX", -( x) );
  1243.           ResPropSetInt(id_map, "ScrollY", -( y) );
  1244.    
  1245.           /* set minimap x and y to draw rect */            
  1246.           id_mini_map = GuiSiblingByName("minimap");
  1247.           minX      = ResPropGetInt(id_mini_map, "X");
  1248.           minY      = ResPropGetInt(id_mini_map, "Y");
  1249.           maxX      = minX + ResPropGetInt(id_mini_map, "Width");
  1250.           maxY      = minY + ResPropGetInt(id_mini_map, "Height");
  1251.           
  1252.           id_mini_map_button = GuiSiblingByName("minimapbutton");    
  1253.           minimap_x = ((x*1000)/ResPropGetInt(id_mini_map_button, "scalemx"))+minX;
  1254.           minimap_y = ((y*1000)/ResPropGetInt(id_mini_map_button, "scalemy"))+minY;
  1255.           
  1256.           ResPropSetInt(ResByName("map.gl/minimapbutton"), "X", minimap_x);
  1257.           ResPropSetInt(ResByName("map.gl/minimapbutton"), "Y", minimap_y);
  1258.           
  1259.            /* set view city on Player */
  1260.           ResPropSetStr(Player, "map_view_city", nav_cur_city);
  1261.           ResPropSetInt(Player, "map_view_city_row_num", nav_cur_city_row_num);
  1262.           
  1263.            /* set view state on Player */
  1264.           ResPropSetStr(Player, "map_view_state", nav_cur_state);
  1265.           ResPropSetInt(Player, "map_view_state_row_num", nav_cur_state_row_num);
  1266.          
  1267.           ResParseEvent(GuiParent(SELF), "@updateCityStateViews");
  1268.         }
  1269.       };
  1270.     }
  1271.   };      /* END OF MAIN CHILDID */
  1272. }
  1273.